/*********************************************************************
 *    Project Name : service-template
 *    Package Name : com.trust.template
 *    Create  Time : 2021/6/28 18:26
 *    =============================================================
 *    (C) Copyright Trustcro Information Technology Co., Ltd.
 *          Corporation 2018-2021 All Rights Reserved.
 *
 *	  【注意： 本内容仅限于长沙信立诚医药科技有限公司内部使用，禁止转发】
 **********************************************************************/
package com.trust.pams;

import com.chasonx.common.annotation.EnableDubboConsumer;
import com.chasonx.common.annotation.EnableRedisConfig;
import com.chasonx.common.interceptor.EnableDapperRequired;
import com.chasonx.mybatis.annotation.EnableMybatisConfig;

import com.fasterxml.jackson.annotation.JsonInclude;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.context.annotation.Bean;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

/**
 * @Project : service-template
 * @Author : Chasonx<zc.x>
 * @CreateTime : 2021/6/28 18:26
 * @Desc :
 * @Version : 1.0
 */
@ComponentScan({"com.trust.pams.*.**"})
@EnableMybatisConfig
@EnableRedisConfig
@EnableDubboConsumer
//开启验证
@EnableDapperRequired
//开启api文档
//@EnableDapperApidoc

@EnableSwagger2
@SpringBootApplication
public class WebRunner {

    public static void main(String[] args) {
        SpringApplication.run(WebRunner.class,args);
    }

    /**
     * 去掉接口返回的json中为null的数据
     *
     * @return
     */
    @Bean
    public Jackson2ObjectMapperBuilderCustomizer customJackson() {
        return jacksonObjectMapperBuilder -> {
            jacksonObjectMapperBuilder.serializationInclusion(JsonInclude.Include.NON_NULL);
            jacksonObjectMapperBuilder.failOnUnknownProperties(false);
            //            jacksonObjectMapperBuilder.propertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
        };
    }
}
